-
Notifications
You must be signed in to change notification settings - Fork 509
Refactor logging to use in-memory buffer instead of file. #961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the logging mechanism by replacing file-based logging with an in-memory buffer that logs to both the console and memory.
- Replaces file logging with a StringIO-based memory buffer
- Updates cleanup and upload functions to clear and use the in-memory log content
Comments suppressed due to low confidence (2)
agentops/logging/instrument_logging.py:18
- [nitpick] The variable 'file_logger' is misleading in the context of in-memory logging. Consider renaming it to 'in_memory_logger' for better clarity.
file_logger = logging.getLogger('agentops_file_logger')
agentops/logging/instrument_logging.py:4
- The 'atexit' module is imported but not used. Remove this unused import to clean up the code.
import atexit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the logging functionality to use an in-memory buffer instead of a file, updating both the logging setup and cleanup mechanisms, and modifying the log upload process.
- Switch from file-based logging to an in-memory buffer
- Update cleanup to clear the in-memory buffer and restore the original print function
- Modify log upload to read and then clear the buffer content
…riginal print function is only replaced once.
bboynton97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i want to test on my machine today but the code looks good
|
tests need updated to account for the new logging method |
tcdent
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get itttt
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
📥 Pull Request
📘 Description
Update print logger to log to buffer and console, and modify cleanup and upload functions to handle buffer content.
🧪 Testing
Describe the tests you performed to validate your changes.